﻿@model wdsDeApp04.Models.Member

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>
<div>
    <input id="text" type="text" placeholder="用户名" value="SanYing" />
    <input id="pwd" type="password" placeholder="密码" value="123456" />
    <br />
    <span style="color:red" id="ts"></span>
    <button onclick="DengLu()">登录</button>
</div>

<script>
    function DengLu() {
        $("#ts").text("");
        $.post("/MyHome/Index", { name: $("#text").val(), pwd: $("#pwd").val() }, function (data) {
            switch (data) {
                case 0:
                    $("#ts").text("用户名或密码错误!");
                    break;
                case 1:
                    alert("登录成功");
                    location = "/MyHome/List";
                    break;
                case 2:
                    console.log("错误");
                    break;
            }
        })
    }
</script>

